package com.kk.controller;


import com.kk.Entry.Employee;
import com.kk.Entry.R;
import com.kk.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private EmpService empService;

    @PostMapping
    public R login(@RequestBody Employee employee) {
        String jwt = empService.loginEmp(employee);
        if (jwt != null) {
            return R.success(jwt);
        }
        return R.fail("用户名密码不正确");
    }

}
